import { EventBus } from "./utils/EventBus"

// 汽车菜单 - DOM 事件绑定


// 修改颜色
const colorDivList = document.querySelectorAll('.col_group>div')
colorDivList.forEach(el => {
  el.addEventListener('click', () => {
    const color = el.dataset.col
    EventBus.getInstance().emit('changeCarColor', color)
  })
})

// 修改粗糙度
const coatDivList = document.querySelectorAll('.coat_group>div')
coatDivList.forEach(el => {
  el.addEventListener('click', () => {
    const coat = el.dataset.co
    EventBus.getInstance().emit('changeCarCoat', coat)
    EventBus.getInstance().emit('countAllPrice')
  })
})

// 场景切换
const sceneDivList = document.querySelectorAll('.scene_group>div')
sceneDivList.forEach(el => {
  el.addEventListener('click', () => {
    const sceneName = el.dataset.poi
    EventBus.getInstance().emit('changeSky', sceneName)
  })
})

// 视角切换
const lookDivList = document.querySelectorAll('.look_group>div')
lookDivList.forEach(el => {
  el.addEventListener('click', () => {
    const viewName = el.dataset.po
    EventBus.getInstance().emit('changeCarAngleView', viewName)
  })
})
